<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jquery-3.5.1.min.js"></script>

<script type="text/javascript">
	$(function() {
		$("#form").submit(check);

	});

	function check() {
		var f1=checkName();
		var f2=checkPassword();
		
		return f1&&f2;
	}

	function checkName() {
		var stand = /^[a-zA-Z0-9]{6,16}$/;
		var flag = stand.test($("#name").val());

		if (flag) {
			return true;
		} else {
			alert("账户格式有误");
			return false;
		}
	}
	function checkPassword() {

		var flag = $("#password").val();
		if (flag == "") {
			alert("请先输入密码");
			return false;
		}else{
			
			return true;
		}
	}
	$(function(){
		$("#code").click(function(){
			var x = Math.random();
			$("#code").attr("src","<%=request.getContextPath()%>/ManegerServlet?action=creatCode&a="+x);	
		});
	});
	
	$(function(){
		$("input[type=text]").css("height","30px");
		$("input[type=password]").css("height","30px");
		
		$("input[type=text]").css("font-size","20px");
		$("input[type=password]").css("font-size","20px");
	});
	
	$(function(){
		$("input[type=text]").css("border-radius","10px");
		$("input[type=password]").css("border-radius","10px");
		
		$("input[type=text]").css("width","200px");
		$("input[type=password]").css("width","200px");
	});
</script>
<style type="text/css">
#submit{
width:200px;
height:60px;
font-size:20px;
font-weight:900;
border-radius:10px;
border:0px;
background-color: white;
margin-left:68px;
background-color: lightblue;
}

#circle{
width:450px;
height:300px;
margin:auto;
border-radius:20px;


background:rgba(255,255,255,0.8);
padding: 20px 20px;
color:#000;
font-family: sans-serif;
}
#form{
margin:20px,0px;
font-size:20px;
font-weight:bold;
padding-left:20px;
}
#error{
width:450px;
height:30px;
font-size:20px;
text-align: center;
color:red;

font-weight: 800;

}
body{

background-image: url("/movies/images/timg .jpg");
background-size:100% 100%;
background-position: center;
background-repeat:no-repeat;
height:450px;
padding:100px 0px;
}
</style>
</head>
<body>
	<div id="circle">
		<%
		String error =request.getParameter("error");
		if("1".equals(error)){%>
			<div id="error">验证码错误</div>
		<%} %>
		<%if("2".equals(error)){%>
			<div id="error">账户密码错误</div>
		<%} %>
	   <div id="form">
		<form action="<%=request.getContextPath()%>/ManegerServlet?action=checkLog" method="post" id="form">
			账&emsp;户&nbsp;<input type="text" name="name" id="name" > <br><br>
			密&emsp;码&nbsp;<input type="password" name="password" id="password" ><br><br> 
			验证码&nbsp;<input type="text" name ="code"> 
			<img align="center" id="code" src ="<%=request.getContextPath()%>/ManegerServlet?action=creatCode">
			<br><br>
			<input type="submit" value="登&emsp;&emsp;&emsp;录" id="submit" id="submit">
		</form>
		</div>
	</div>
</body>
</html>